import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'login',
    component: () => import('../views/login.vue')
  },
  {
    path: '/index',
    name: 'index',
    component: () => import('../views/index.vue')
  },
  {
    path: '/mine',
    name: 'mine',
      component: () => import('../views/mine.vue')
  },{
    path: '/page3:id',
    name: 'page3',
      component: () => import('../views/page3.vue')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})
// router.beforeEach((to,from,next)=>{
//   if (to.path === '/page2' || to.path === '/') {
//     next()
//   }else{
//     // next({ path: '/login' })
//     next('/login')
//   }
// })
export default router
